import { mpjLog } from './log';
import {ErrorHandler, Injectable} from '@angular/core'

@Injectable()
export class MyErrorHandler extends ErrorHandler {
  
  constructor() { 
    // We rethrow exceptions, so operations like 'bootstrap' will result in an error
    // when an error happens. If we do not rethrow, bootstrap will always succeed.
    super(true);
  }
  
  handleError(error) {
    mpjLog.error({
            source:"MyErrorHandler:handleError",
            message:error.message || error,
            stack:error.stack,
            extended:{}
    });
    super.handleError(error);  
  }
}